package com.demo.common.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioConfig {

    /**
     * endPoint是一个URL，域名，IPv4或者IPv6地
     */
    @Value("${minio.endpoint}")
    private String endpoint;

    /**
     * * accessKey类似于用户ID，用于唯一标识你的账户
     */
    @Value("${minio.accessKey}")
    private String accessKey;

    /**
     * secretKey是你账户的密码
     */
    @Value("${minio.secretKey}")
    private String secretKey;

    @Bean
    public MinioClient minioClient(){
        new MinioUtils(endpoint,"avatar",accessKey,secretKey);
        return MinioClient.builder().endpoint(endpoint).credentials(accessKey,secretKey).build();

    }
}
